package demo.quartz;


import demo.annotation.RecordMe;
import demo.utils.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class QuartzUtil {

    private Logger logger = LoggerFactory.getLogger(this.getClass());


    static long startTime = System.currentTimeMillis();


    public void heartBeat() {
        logger.debug(DateUtil.formatDateTime(new Date()) + " alive - " +DateUtil.formatDuring(System.currentTimeMillis() - startTime));
    }


    @RecordMe(methodName = "heart")
    public void remindMe(){
        System.out.println(DateUtil.getNow());
    }



}
